xen/hypfs: support dynamic hypfs nodes
authorJuergen Gross <jgross@suse.com>
Fri, 22 Jan 2021 11:13:40 +0000 (12:13 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 22 Jan 2021 11:13:40 +0000 (12:13 +0100)
commit0b3b53be8cf226d947a79c2535a9efbb2dd7bc38
tree0b3b607172cf9eb009344792a52ab9bb5b1a0e20
parentba584fb1a26c058ebd0e6a2779287b3e4400415c
xen/hypfs: support dynamic hypfs nodes

Add a HYPFS_VARDIR_INIT() macro for initializing such a directory
statically, taking a struct hypfs_funcs pointer as parameter additional
to those of HYPFS_DIR_INIT().

Modify HYPFS_VARSIZE_INIT() to take the function vector pointer as an
additional parameter as this will be needed for dynamical entries.

For being able to let the generic hypfs coding continue to work on
normal struct hypfs_entry entities even for dynamical nodes add some
infrastructure for allocating a working area for the current hypfs
request in order to store needed information for traversing the tree.
This area is anchored in a percpu pointer and can be retrieved by any
level of the dynamic entries. The normal way to handle allocation and
freeing is to allocate the data in the enter() callback of a node and
to free it in the related exit() callback.

Add a hypfs_add_dyndir() function for adding a dynamic directory
template to the tree, which is needed for having the correct reference
to its position in hypfs.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/hypfs.c
xen/include/xen/hypfs.h